load("//bazel:ray.bzl", "ray_cc_library")

ray_cc_library(
    name = "gcs_client",
    srcs = [
        "accessor.cc",
        "gcs_client.cc",
    ],
    hdrs = [
        "accessor.h",
        "gcs_client.h",
    ],
    deps = [
        ":accessor_factory_interface",
        ":actor_accessor_interface",
        ":gcs_client_context",
        ":gcs_client_defaults",
        ":rpc_client",
        "//src/ray/common:asio",
        "//src/ray/common:id",
        "//src/ray/common:placement_group",
        "//src/ray/common:protobuf_utils",
        "//src/ray/gcs/store_client:redis_store_client",
        "//src/ray/protobuf:usage_cc_proto",
        "//src/ray/pubsub:gcs_subscriber",
        "//src/ray/pubsub:subscriber",
        "//src/ray/util:container_util",
        "//src/ray/util:network_util",
        "//src/ray/util:sequencer",
    ],
)

ray_cc_library(
    name = "global_state_accessor_lib",
    srcs = ["global_state_accessor.cc"],
    hdrs = ["global_state_accessor.h"],
    deps = [
        ":gcs_client",
        "//src/ray/util:time",
    ],
)

ray_cc_library(
    name = "accessor_factory_interface",
    hdrs = [
        "accessor_factory_interface.h",
    ],
    visibility = ["//visibility:public"],
    deps = [],
)

ray_cc_library(
    name = "actor_accessor_interface",
    hdrs = [
        "accessors/actor_info_accessor_interface.h",
    ],
    visibility = ["//visibility:public"],
    deps = [
        "//src/ray/common:gcs_callback_types",
        "//src/ray/common:id",
        "//src/ray/common:placement_group",
        "//src/ray/common:task_common",
        "//src/ray/protobuf:autoscaler_cc_proto",
        "//src/ray/protobuf:gcs_cc_proto",
    ],
)

ray_cc_library(
    name = "gcs_client_context",
    hdrs = [
        "gcs_client_context.h",
    ],
    visibility = [":__pkg__"],
    deps = [
        ":rpc_client",
        "//src/ray/pubsub:gcs_subscriber",
    ],
)

ray_cc_library(
    name = "actor_accessor_implementation",
    srcs = [
        "accessors/actor_info_accessor.cc",
    ],
    hdrs = [
        "accessors/actor_info_accessor.h",
    ],
    visibility = [":__pkg__"],
    deps = [
        ":actor_accessor_interface",
        ":gcs_client_context",
        ":rpc_client",
        "//src/ray/common:asio",
        "//src/ray/common:id",
        "//src/ray/common:placement_group",
        "//src/ray/common:protobuf_utils",
        "//src/ray/gcs/store_client:redis_store_client",
        "//src/ray/protobuf:usage_cc_proto",
        "//src/ray/pubsub:gcs_subscriber",
        "//src/ray/pubsub:subscriber",
        "//src/ray/util:container_util",
        "//src/ray/util:network_util",
        "//src/ray/util:sequencer",
        "@com_google_absl//absl/container:flat_hash_map",
        "@com_google_absl//absl/container:flat_hash_set",
    ],
)

ray_cc_library(
    name = "gcs_client_defaults",
    srcs = [
        "default_accessor_factory.cc",
        "default_gcs_client_context.cc",
    ],
    hdrs = [
        "default_accessor_factory.h",
        "default_gcs_client_context.h",
    ],
    visibility = [":__pkg__"],
    deps = [
        ":accessor_factory_interface",
        ":actor_accessor_implementation",
        ":actor_accessor_interface",
        ":gcs_client_context",
    ],
)

ray_cc_library(
    name = "rpc_client",
    hdrs = [
        "rpc_client.h",
    ],
    visibility = [
        ":__pkg__",
        "//src/ray/pubsub:__pkg__",
    ],
    deps = [
        "//src/ray/common:ray_config",
        "//src/ray/protobuf:autoscaler_cc_grpc",
        "//src/ray/protobuf:gcs_service_cc_grpc",
        "//src/ray/rpc:retryable_grpc_client",
        "//src/ray/rpc:rpc_callback_types",
        "//src/ray/util:network_util",
    ],
)
